//
//  WeiBoCommon.swift
//  新浪微博
//
//  Created by 张甜甜 on 2017/11/27.
//  Copyright © 2017年 sweet. All rights reserved.
//

import Foundation
//应用程序信息
//应用程序ID
let WBAppKey = "715990683"
//应用程序加密信息 开发者可以修改
let WBAppSecret = "9f4a158f508e639874a241d5cb2f022b"
//回调地址 登录成功跳转的Url 参数以get形式拼接
let WBRedirectUrl = "http://baidu.com"

//全局通知定义
let WBUserShouldLoginNotification = "WBUserShouldLoginNotification"
let WBUserLoginSuccessNotification = "WBUserLoginSuccessNotification"

///
/// @param selectedIndex    选中照片索引
/// @param urls             浏览照片 URL 字符串数组
/// @param parentImageViews 父视图的图像视图数组，用户展现和解除转场动画参照

//照片浏览通知定义
let WBStatusCellBrowserPhotoNotification = "WBStatusCellBrowserPhotoNotification"
//选中索引Key
let WBStatusCellBrowserPhotoSelectedIndexKey = "WBStatusCellBrowserPhotoSelectedIndexKey"
//浏览照片URL字符窜Key
let WBStatusCellBrowserPhotoURLsKey = "WBStatusCellBrowserPhotoURLsKey"
//父视图的图像视图key
let WBStatusCellBrowserPhotoImageViewsKey = "WBStatusCellBrowserPhotoImageViewsKey"

//全局宽高定义
let ScreenWidth = UIScreen .cz_screenWidth()
let ScreenHeight = UIScreen .cz_screenHeight()

//计算配图视图的宽带
//常数准备
//配图视图我外侧的间距
let WBStatusPictureViewOutMargin = CGFloat(12)
//配图视图图像内部间距
let WBStatusPictureViewInnerMargin = CGFloat(3)
//视图宽度
let WBStatusPictureViewWidth = ScreenWidth - 2*WBStatusPictureViewOutMargin
//计算每个Item的默认宽度
let WBStatusPictureItemWidth = ((WBStatusPictureViewWidth)-(2*WBStatusPictureViewInnerMargin)) / 3

func getLabelAttributedTextHeight(lableStr:NSAttributedString,font:UIFont,width:CGFloat)->CGFloat{
    let statusLabelText: NSAttributedString = lableStr as NSAttributedString
    let size = CGSize(width: width, height: 900)
    let strSize = statusLabelText.boundingRect(with: size, options: [.usesLineFragmentOrigin], context: nil)
//    let strSize = statusLabelText .boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font:font] , context: nil).size
    return strSize.height
}
func getLabHeigh(labelStr:String,font:UIFont,width:CGFloat) -> CGFloat {
    let statusLabelText: NSString = labelStr as NSString
    let size = CGSize(width: width, height: 900)
    let strSize = statusLabelText .boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font:font] , context: nil).size
    return strSize.height
}

func getLabWidth(labelStr:String,font:UIFont,height:CGFloat) -> CGFloat {
    
    let statusLabelText: NSString = labelStr as NSString
    let size = CGSize(width: 900, height: height)
    let strSize = statusLabelText.boundingRect(with: size, options: .usesLineFragmentOrigin, attributes: [NSAttributedStringKey.font:font], context: nil).size
    return strSize.width
}

